https://leetcode.cn/problems/generate-parentheses/
class Solution {
public:
    vector<string>ret;
    string path;
    int left,right,_n;
    void dfs()
    {
        if(right==_n)
        {
            ret.push_back(path);
            return ;
        }

        if(left<_n)
        {
            path.push_back('(');
            left++;
            dfs();
            //恢复
            left--;
            path.pop_back();
        }
        if(right<left)
        {
            path.push_back(')');
            right++;
            dfs();
            right--;
            path.pop_back();
        }


    }
    vector<string> generateParenthesis(int n) {
        _n=n;
        dfs();
        return ret;
    }
};